package com.swss.g.base;

import java.io.Serializable;
import java.util.List;

import com.swss.util.Pagination;

public interface BaseService<T extends Serializable> {

	public T get(Serializable id) throws Exception;

	public T save(T entity) throws Exception;

	public void delete(T entity) throws Exception;

	public void deleteAll(List<T> entities) throws Exception;

	public T update(T entity) throws Exception;

	public T saveOrUpdate(T entity) throws Exception;

	@SuppressWarnings("unchecked")
	public Pagination<T> findByHql(String hql, Pagination pageControl)
			throws Exception;

	@SuppressWarnings("unchecked")
	public Pagination<T> findByExample(T example, Pagination pagination)
			throws Exception;

	public List<T> findByExample(T example) throws Exception;

	public T findOneByExample(T example) throws Exception;

	@SuppressWarnings("unchecked")
	public Pagination<T> findAll(Pagination pagination) throws Exception;

	@SuppressWarnings("unchecked")
	public Pagination<T> findByLike(T example, Pagination pagination)
			throws Exception;

	public int findCount() throws Exception;

}
